package com.ushio.gougouwangguo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ushio.gougouwangguo.entity.mysql.AdventureType;
import com.ushio.gougouwangguo.entity.vo.AdventureTypeDispositionVo;
import com.ushio.gougouwangguo.entity.vo.AdventureTypeVo;
import com.ushio.gougouwangguo.mapper.AdventureTypeMapper;
import com.ushio.gougouwangguo.service.AdventureTypeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdventureTypeServiceImpl  extends ServiceImpl<AdventureTypeMapper,AdventureType> implements AdventureTypeService {

    @Autowired
    AdventureTypeMapper adventureTypeMapper;

    @Override
    public AdventureTypeVo getAdventureType(Integer adventureTypeId){

        AdventureType adventureType = adventureTypeMapper.selectById(adventureTypeId);

        AdventureTypeVo adventureTypeVo = AdventureTypeVo.builder().build();

        BeanUtils.copyProperties(adventureType,adventureTypeVo);

        List<AdventureTypeDispositionVo> adventureTypeDispositionVos = adventureTypeMapper.selectAdventureTypeDisposition(adventureTypeId);
        adventureTypeVo.setAdventureTypeDispositionVos(adventureTypeDispositionVos);
        return adventureTypeVo;
    }


}
